<ul>
    <?php
        foreach($schedules as $index => $schedule){
            $dates[date('Y-m-d',strtotime($schedule->start_time))][] = $schedule;
        }
    ?>    
    <li><strong><?php echo $movie->title;?> Showing at:<?php echo $branch->name;?></strong></li>
    <?php foreach($dates as $index => $date):?>
        <li>
        <div class="">
            <p style="padding:0 0 5px 0;"><?php echo date('D j M Y',strtotime($index));?></p>
            <div style="">
            <?php foreach($date as $index => $schedule):?>
                <?php 
                    if($this->session->userdata('id') == ''){
                        $url = 'javascript:alert(\'please login first\');void(0);';
                    }else{
                        $url = site_url('booking/book/'.$schedule->id);
                    }
                    
                
                ;?>
                <span><a href="<?php echo $url;?>"><?php echo date('H:i',strtotime($schedule->start_time));?></a></span>
            <?php endforeach?>
            </div>
        </div>    
        </li>
    <?php endforeach?>
</ul>  